<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        .errorCla{
            color: red;
            font-size: 9pt;
        }
    </style>
</head>
<body>
<%
    Cookie[] cookies = request.getCookies();
    if(null != cookies){
        for (int i = 0; i < cookies.length; i++) {
            Cookie cookie = cookies[i];
            if(cookie.getName().equals("userInfo")){
                String value = cookie.getValue();
                String[] userInfo = value.split("\\|");
                String userName = userInfo[0];
                String password = userInfo[1];
                request.setAttribute("userName", userName);
                request.setAttribute("password", password);
            }
        }
    }
%>
<div>
    <form action="${pageContext.request.contextPath}/doReg3.action" method="post">
        <table>
            <tr>
                <td>
                    <h1>用户登录</h1>
                </td>
            </tr>
            <tr>
                <td>
                    账号：<input type="text" name="username" autocomplete="off" value="${username}">
                </td>
            </tr>
            <tr>
                <td>
                    密码：<input type="password" name="psd" value="${password}">
                </td>
            </tr>
            <tr >
                <td class="errorCla">
                    ${requestScope.mess}
                </td>

            </tr>
            <tr>
                <td>
                    <select>
                        <option name="no" value="true">不保存</option>
                        <option name="day" value="true">保存一天</option>
                        <option name="week" value="true">保存一周</option>
                        <option name="month" value="true">保存一个月</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="submit" value="登录">
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
<script>
    //防止页面后退

    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    },false);
</script>
</html>
